#include<stdio.h>
#include<math.h>
#include<string.h>

int main()
{
	char bk[1001],buf[101];
	gets(bk);
	int n;
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++)
	{
		gets(buf);
		char *found=strstr(bk,buf);
		if(found)
		{
			printf("%d\n",(int)(found-bk));
		}
		else
			printf("Spell Not Found!\n");
	}
	return 0;
}